package br.com.winesys.geta.databinding.component.editor;

import java.text.NumberFormat;
import java.text.ParseException;

public class FloatEditor extends NumberEditor {

    public FloatEditor() {
        super();
        setFormat("#,##0.00");
    }

    public FloatEditor(String format) {
        super(format);
    }

    public FloatEditor(NumberFormat format) {
        super(format);
    }

    @Override
    public Object getValue() {
        try {
            Object value = getText();
            return this.numberFormat.parse(value.toString()).floatValue();
        } catch (ParseException ex) {
            return null;
        }
    }
}
